﻿using Face8280WebSocketServer.Interface;
using Face8280WebSocketServer.Model.People;
using Face8280WebSocketServer.Utility.VerifyAttribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Face8280WebSocketServer.Controllers.People
{
    /// <summary>
    /// 设备的参数
    /// </summary>
    public class PeopleBaseParameter
    {

        /// <summary>
        /// 人员编号（数字<20位）
        /// </summary>
        [VerifyLong(iMax: UInt32.MaxValue, iMin: 0,
                errCode: 1, sErrorDesc: "人员编号超出范围(1-4294967295)")]
        public long EmployeeID { get; set; } //是
        /// <summary>
        /// 人员姓名（字符<30位）
        /// </summary>
        [VerifyText(iMax: 30, iMin: 1, required: true,
            errCode: 2, sErrorDesc: "人员姓名由1-30个字符组成")]
        public string EmployeeName { get; set; } //是
        /// <summary>
        /// 职务
        /// </summary>
        [VerifyText(iMax: 30, iMin: 0, required: false,
            errCode: 3, sErrorDesc: "职务长度不能超过30个字")]
        public string EmployeeJob { get; set; } //否

        /// <summary>
        /// 密码，纯数字,长度：（0 / 4-8）
        /// </summary>
        [VerifyNumText(iMax: 8, iMin: 4, required: false,
            errCode: 4, sErrorDesc: "密码由4-8个数字组成")]
        public string EmployeePassword { get; set; } //否

        /// <summary>
        /// 照片格式”base”:bse64 编码字符，”path”:下载路径
        /// </summary>
        [VerifyTextRange(sRange:new string[] { "Delete", "NULL", "base", "path" }, 
            errCode: 5, sErrorDesc: "照片格式: Delete,base, path")]
        public string EmployeePhotoWay { get; set; }

        /// <summary>
        /// IC卡号 纯数字
        /// </summary>
        [VerifyLong(iMax: UInt32.MaxValue, iMin: 0,
                errCode: 6, sErrorDesc: "IC卡号超出范围(1-4294967295)")]
        public long EmployeeIC { get; set; } //否

        /// <summary>
        /// 联系方式
        /// </summary>
        [VerifyText(iMax: 30, iMin: 0, required: false,
            errCode: 7, sErrorDesc: "联系方式长度不能超过30个字")]
        public string EmployeePhone { get; set; } //否
        /// <summary>
        /// 人脸识别阈值，0:未设置，其他：阈值大小 1-99
        /// </summary>
        [VerifyNum(iMax: 99, iMin: 0,
                    errCode: 8, sErrorDesc: "人脸识别阈值超出范围(范围 0-99)")]
        public int EmployeeShold { get; set; } //否
        /// <summary>
        /// 身份证信息
        /// </summary>
        [VerifyText(iMax: 30, iMin: 0, required: false,
            errCode: 9, sErrorDesc: "身份证信息长度不能超过30个字")]
        public string EmployeeIdentity { get; set; } //否
        /// <summary>
        /// 地址信息
        /// </summary>
        [VerifyText(iMax: 30, iMin: 0, required: false,
            errCode: 10, sErrorDesc: "地址信息长度不能超过30个字")]
        public string EmployeeAddress { get; set; } //否

        /// <summary>
        /// 将参数拷贝到 FacePeople
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public virtual FacePeople CopyTo(FacePeople target)
        {
            var src = this;
            target.EmployeeID = src.EmployeeID;//人员编号（数字<20位）|
            target.EmployeeName = src.EmployeeName;//人员姓名（字符<32位）|
            target.EmployeeJob = src.EmployeeJob;//职务|
            target.EmployeePassword = src.EmployeePassword;//密码，纯数字,长度：（0 / 4-8）|
            target.EmployeePhotoWay = src.EmployeePhotoWay;//照片格式”base”:bse64 编码字符，”path”:下载路径|
            target.EmployeeIC = src.EmployeeIC;//IC卡号 纯数字|
            target.EmployeePhone = src.EmployeePhone;//联系方式|
            target.EmployeeShold = src.EmployeeShold;//人脸识别阈值，0:未设置，其他：阈值大小|
            target.EmployeeIdentity = src.EmployeeIdentity;//身份证信息|
            target.EmployeeAddress = src.EmployeeAddress;//地址信息|
            return target;
        }
    }
}
